import request from '@/utils/request'
// 证件号密码
export function login(type, params) {
  return request({
    url: '/account-info/login/' + type,
    method: 'post',
    data: params
  })
}
// 手机号登录
export function loginPhone(type, params) {
  return request({
    url: '/account-info/login/' + type,
    method: 'POST',
    headers: {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Credentials': 'true',
      'Content-Type': 'application/json'
    },
    data: params
  })
}
// 柜员登录
export function loginOperation(params) {
  return request({
    url: '/employee-account/login',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}
// 验证码
export function getCode(params) {
  return request({
    url: '/account-info/code/' + params,
    method: 'get',
    headers: {
      'token': localStorage.getItem('token')
    }
  })
}
// 设置密码
export function setPassword(params) {
  return request({
    url: '/account-info/password',
    method: 'post',
    data: params,
    headers: {
      'token': localStorage.getItem('token')
    }
  })
}

// 余额查询
export function getMoney() {
  return request({
    url: '/account-info/account-balance/check_balance',
    method: 'get',
    headers: {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Credentials': 'true',
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    }
  })
}
// 用户转账
export function transformMoney(parmas) {
  return request({
    url: '/account-info/saveTransferAccount',
    method: 'POST',
    headers: {
      'token': localStorage.getItem('token')
    },
    data: parmas
  })
}
// 交易流水
// export function getTrade(params) {
//   return request({
//     url: '/account-info/getTradeList',
//     method: "post",
//     headers: {
//       'Content-Type': 'application/json',
//     },
//     data:params
//   })
// }
export function getTrade(params) {
  return request({
    url: '/account-info/getTradeList',
    method: 'get',
    headers: {
      'token': localStorage.getItem('token')
    },
    params: params
  })
}
// 柜面存款
export function saveMoney(params) {
  return request({
    url: '/employee-account/saveMoney?bankCard=' + params.bankCard + '&currentBalance=' + params.currentBalance,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    }
    // data: params
  })
}
// 柜面取款
export function drawMoney(params) {
  return request({
    url: '/employee-account/drawMoney?bankCard=' + params.bankCard + '&password=' + params.password + '&currentBalance=' + params.currentBalance,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    }
    // data: params
  })
}
// 开户
export function signUp(params) {
  return request({
    url: '/account-info/signup',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
    data: params
  })
}
// 利息结算
export function interestSettlement(params) {
  return request({
    url: '/employee-account/add/' + params.bankCard,
    method: 'post',
    headers: {
      'token': localStorage.getItem('token')
    }
  })
}
